<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>倒计时</title>
    <style>
        #background{
            background:url("img/timg.jpg");
            background-repeat:no-repeat;
            background-size: cover;
        }
        #page{
            color: #ff0000;

            position: absolute;
            left: 620px;
            top: 610px;
        }
    </style>
</head>
<body id="background">
<div id="page">
    <h1>还有<span class="clock">5</span>进入搜索页面</h1>
</div>
<script>
    var t = 5;
    var time = document.getElementsByClassName("clock")[0];
    function fun() {
        t--;
        time.innerHTML = t;
        if(t==0) {
            location.href = "https://www.baidu.com";
            clearInterval(inter);
        }
    }
    var inter = setInterval("fun()", 1000);
</script>
</body>
</html>
